package howSelectCollection;

import java.util.*;

/**
 * Created by think on 2016/7/5.
 */
public class SelectCollect {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<Integer>();
        List<Integer> list1 = new LinkedList<Integer>();
        Random random = new Random();
        for(int i=0;i<3000000;i++){
            list.add(random.nextInt(5000));
            list1.add(random.nextInt(5000));
        }

        long start2 = System.currentTimeMillis();
        //System.out.println(list.contains(1));
        for(int i:list){

        }
        long end2 = System.currentTimeMillis();
        System.out.println((end2 - start2));

        long start = System.currentTimeMillis();
        Set<Integer> set = new HashSet<Integer>(list);
        //System.out.println(set.contains(1));
        for(int i:set){

        }
        long end = System.currentTimeMillis();
        System.out.println((end - start));

        long start1 = System.currentTimeMillis();
        //System.out.println(list1.contains(1));
        for(int i:list1){

        }
        long end1 = System.currentTimeMillis();
        System.out.println((end1 -start1));
    }
}
